package com.kucai.yifaqapp.ui.fragment;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.kucai.yifaqapp.R;
import com.kucai.yifaqapp.ui.fragment.gameFragment.KSFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.LHCFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.LHCSFFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.LHCXGFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.LHCYFFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.NCragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.NNFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.PCFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.SSCFragment;
import com.kucai.yifaqapp.ui.fragment.gameFragment.z_game1;
import com.kucai.yifaqapp.util.EventBus.GameDetailConstances;

/**
 * 游戏fragment
 */
public class z_gameFragment extends BaseFragmentSimple {
    FrameLayout content;

    @Override
    protected void ChangeSkin() {

    }

    @Override
    protected int setContentView() {
        return R.layout.z_gamefragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.z_gamefragment, container, false);
        FragmentManager fm = getChildFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        switch (GameDetailConstances.GameId) {
            //秒速赛车，北京赛车，香港跑马，秒速飞艇，快乐赛车，快乐飞艇
            case 80:
            case 50:
            case 55://幸运飞艇
            case 82:
            case 99:
            case 801:
            case 802:
            case 804:
            case 901://三分赛车
                z_game1 z_game1 = new z_game1();
                if (!z_game1.isAdded()) {
                    ft.add(R.id.content, z_game1, "1");
                }
                ft.commit();
                ft.show(z_game1);
                break;
            //时时彩
            case 1:
            case 4:
            case 81:
                //腾讯分分彩
            case 112:
                //QQ分分彩
            case 113:
                //快乐分分彩
            case 803:
                //三分时时彩
            case 902:
                SSCFragment z_game2 = new SSCFragment();
                if (!z_game2.isAdded()) {
                    ft.add(R.id.content, z_game2, "1");
                }
                ft.commit();
                ft.show(z_game2);
                break;
//                z_sscFragment z_game2 = new z_sscFragment();
//                if (!z_game2.isAdded()) {
//                    ft.add(R.id.content, z_game2, "1");
//                }
//                ft.commit();
//                ft.show(z_game2);
//                break;
            //牛牛
            case 90:
            case 91:
                NNFragment z_game3 = new NNFragment();
                if (!z_game3.isAdded()) {
                    ft.add(R.id.content, z_game3, "1");
                }
                ft.commit();
                ft.show(z_game3);
                break;
            //快三
            case 86:
            case 10:
            case 12:
            case 13:
            case 16:
            case 15:
            case 18:
            case 11:
                KSFragment z_game4 = new KSFragment();
                if (!z_game4.isAdded()) {
                    ft.add(R.id.content, z_game4, "1");
                }
                ft.commit();
                ft.show(z_game4);
                break;
            case 70:
                //香港六合彩
                LHCXGFragment z_game8 = new LHCXGFragment();
                if (!z_game8.isAdded()) {
                    ft.add(R.id.content, z_game8, "1");
                }
                ft.commit();
                ft.show(z_game8);
                break;
            case 85:
                //幸运六合彩
                LHCFragment z_game5 = new LHCFragment();
                if (!z_game5.isAdded()) {
                    ft.add(R.id.content, z_game5, "1");
                }
                ft.commit();
                ft.show(z_game5);
                break;
            case 903:
                //急速六合彩    一分六合彩
                LHCYFFragment z_game9 = new LHCYFFragment();
                if (!z_game9.isAdded()) {
                    ft.add(R.id.content, z_game9, "1");
                }
                ft.commit();
                ft.show(z_game9);
                break;
            case 904:
                //三分六合彩    一分六合彩
                LHCSFFragment z_game10 = new LHCSFFragment();
                if (!z_game10.isAdded()) {
                    ft.add(R.id.content, z_game10, "1");
                }
                ft.commit();
                ft.show(z_game10);
                break;
            //幸运农场
            case 61:
                //11选五
            case 21:
                //快乐十分
            case 60:
                NCragment z_game6 = new NCragment();
                if (!z_game6.isAdded()) {
                    ft.add(R.id.content, z_game6, "1");
                }
                ft.commit();
                ft.show(z_game6);
                break;

            case 66:
                //pc蛋蛋//
            case 65:
                //快乐北京8
                PCFragment z_game7 = new PCFragment();
                if (!z_game7.isAdded()) {
                    ft.add(R.id.content, z_game7, "1");
                }
                ft.commit();
                ft.show(z_game7);
                break;
            default:
                break;
        }
        return v;
    }


    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
    }
}
